Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 3 - Image Compression Manager / Image Compression Manager Reference
Image Compression Manager Functions / Working With Images


TrimImage

The TrimImage function adjusts a compressed image to the boundaries defined by a rectangle specified by your application.

pascal OSErr TrimImage (ImageDescriptionHandle desc, Ptr inData, 
                        long inBufferSize, 
                        DataProcRecordPtr dataProc, 
                        Ptr outData, long outBufferSize,
                        FlushProcRecordPtr flushProc, 
                        Rect *trimRect, 
                        ProgressProcRecordPtr progressProc);
desc
Contains a handle to the image description structure that describes the compressed image. On return from TrimImage, the compressor updates this image description to refer to the resized image.
inData
Points to the compressed image data. If the entire compressed image cannot be stored at this location, your application may provide a data-loading function (see the discussion of the dataProc parameter to this function). This pointer must contain a 32-bit clean address.
inBufferSize
Specifies the size of the buffer to be used by the data-loading
function specified by the dataProc parameter. If you have not specified a data-loading function, this parameter is ignored.
dataProc
Points to a data-loading function structure. If there is not enough memory to store the compressed image, the compressor calls a function you provide that loads more compressed data (see "Data-Loading Functions" beginning on page 3-153 for more information about data-loading function structures). If you have not provided a data-loading function, set this parameter to nil. In this case, the compressor expects that the entire compressed image is in the memory location specified by the inData parameter.
outData
Points to a buffer to receive the trimmed image. Your application should create this destination buffer at least as large as the source image. If there is not sufficient memory to store the compressed image, you may choose to write the compressed data to mass storage during the compression operation. Use the flushProc parameter to identify your data-unloading function to the compressor. This pointer must contain a 32-bit clean address.
The Image Compression Manager places the actual size of the resulting image into the dataSize field of the image description structure referred to by the desc parameter.
outBufferSize
Specifies the size of the buffer to be used by the data-unloading
function specified by the flushProc parameter. If you have not specified a data-unloading function, this parameter is ignored.
flushProc
Points to a data-unloading function structure. If there is not enough memory to store the compressed image, the compressor calls a function you provide that unloads some of the compressed data (see "Data-Unloading Functions" beginning on page 3-154 for more information on the data-unloading structure). If you have not provided a data-unloading function, set this parameter to nil. In this case, the compressor writes the entire compressed image into the memory location specified by the data parameter.
trimRect
Contains a pointer to a rectangle that defines the desired image dimensions. Upon return to your application, the compressor adjusts the rectangle values so that they refer to the same rectangle in the result image (this is necessary whenever data is removed from the beginning or from the left side of the image).
progressProc
Points to a progress function structure. During the operation, the compressor may occasionally call a function you provide in order to report its progress (see "Progress Functions" on page 3-156 for more information about progress functions). If you have not provided a progress function, set this parameter to nil. If you pass a value of -1, you obtain a standard progress function.
DESCRIPTION
The resulting image data is still compressed and is in the same compression format as the source image.

RESULT CODES
noErr0No error
paramErr-50Invalid parameter specified
memFullErr-108Not enough memory available
noCodecErr-8961The Image Compression Manager could not find the specified compressor
codecUnimpErr-8962Feature not implemented by this compressor
codecSpoolErr-8966Error loading or unloading data
codecAbortErr-8967Operation aborted by the progress function

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996